home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / toasterpaint / export.rexx < prev    next >
OS/2 REXX Batch file  |  1995-12-22  |  2KB  |  85 lines

  1. /* Export.rexx V2.0  -- Save A File Using Hiip         */
  2. /* © 1995 NewTek, Inc. By Bob Caron (Grue)             */
  3.  
  4. call remlib('rexxsupport.library')
  5. call ADDLIB("rexxsupport.library", 0,-30,0)
  6. if pos('DigiPaint',show(ports))=0 then do
  7.   exit
  8. end
  9.  
  10. options results
  11.  
  12. if ~exists("hiip:") then address command "c:assign hiip: toaster:programs/hiip_support"
  13.  
  14. path="hiip:savers"
  15.  
  16. dir = showdir(path ,'f','*')
  17. test=translate(dir,'?',' ','?')
  18. test2=translate(test,' ','*',' ')
  19. dir = test2
  20.  
  21. Address "DigiPaint"     /* Tell ARexx where commands go  */
  22.  'Dnam'"Hiip:savers/"
  23.  'Fnam'"jpeg"
  24.  'Askf' "Format?"
  25.  file=result
  26.  
  27.  if lastpos('/',file,length(file)-1)~=0 then do
  28.     filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  29.     path=left(file,(lastpos('/',file,length(file))-1))
  30.     end
  31.  else do
  32.     filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  33.     path=left(file,(lastpos(':',file,length(file))))
  34.     end
  35.  
  36.  validsaver=fileisgood(filenam,dir)
  37.  if upper(right(filenam,4))=".CAP" then filenam=left(filenam,length(file)-4)
  38.  
  39. /* OK! So if you dump any weird file in hiip:savers it will attempt to use*/
  40. /* it as a saver! Sigh. Not much I can do about that ;)                   */
  41.  
  42.  if validsaver=0 then do
  43.    'Askb'"That isn't a valid;HIIP Saver!"
  44.    exit
  45.    end
  46.  
  47.  format=filenam
  48.  
  49.  'Dnam'"Toaster:images"
  50.  'Fnam'""
  51.  'Askf' "Save As"
  52.  file=result
  53.  
  54.  if lastpos('/',file,length(file)-1)~=0 then do
  55.     filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  56.     path=left(file,(lastpos('/',file,length(file))-1))
  57.     end
  58.  else do
  59.     filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  60.     path=left(file,(lastpos(':',file,length(file))))
  61.     end
  62.  
  63. if exists("t:temp") then address command "c:delete t:temp"
  64.  
  65.  'Sa24'
  66.  'Fnam'"T:temp"         /* Enter File name  */
  67.  'Okls'                 /* Hit the OK button  */
  68.  
  69.  
  70. address command "c:wait 6"
  71. address command "C:gnusto t:temp "||file||" image saver "||format
  72. address command "c:delete t:temp"
  73.  
  74. exit
  75.  
  76. fileisgood:
  77. parse arg file,dir
  78. loopto=words(dir)
  79. loop=1
  80. do while (loop<loopto)
  81.    if file=word(dir,loop) then return 1
  82.    loop=loop+1
  83.    end
  84. return 0
  85.